Skip to content

Claude/fix ravens voice first response 4 a9 ix#456

Open
DHCross wants to merge 17 commits intomainfrom
claude/fix-ravens-voice-first-response-4A9Ix
Open

Claude/fix ravens voice first response 4 a9 ix#456
DHCross wants to merge 17 commits intomainfrom
claude/fix-ravens-voice-first-response-4A9Ix

Conversation

@DHCross
Copy link
Copy Markdown
Owner

@DHCross DHCross commented Apr 26, 2026

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shipyard Error Error Apr 27, 2026 6:50am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to address “first-response” quality and operational recovery in Raven by (1) splitting doctrinal vs infrastructure telemetry buckets, (2) introducing authority-lamp routing/validators and Symbolic Moment variant selection, and (3) improving client UI/UX and resilience (safe-area sizing, voice replay, better error surfacing, profile selection).

Changes:

  • Add authority-lamp templates/validators + UI badge and related tests/docs.
  • Split telemetry into doctrinal signal-void vs infrastructure-event buckets across persistence, planner counters, and operator tooling (flight recorder / export).
  • Improve client experience: iOS-safe viewport sizing (dvh), richer upstream error messages, voice warm-up/replay, and vault-profile selection in planner scatter.

Reviewed changes

Copilot reviewed 75 out of 83 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vessel/src/test/safe-area-shell.test.ts Updates safe-area shell assertion for min-h-dvh.
vessel/src/test/raven-turn-continuity.test.ts Moves continuity-law assertions to route.ts source.
vessel/src/lib/vaultSync.ts Exposes vaultProfileToBirthInput() wrapper for reuse.
vessel/src/lib/stripe.ts Forces Stripe apiVersion via as any.
vessel/src/lib/server/systemEventsMirror.ts Documents persistable system-event vocabulary/buckets.
vessel/src/lib/raven/symbolicMomentVariants.ts Adds deterministic variant pools + seed selection helpers.
vessel/src/lib/raven/symbolicMomentFrontstage.ts Refactors symbolic-moment frontstage tightening + adds fallback construction.
vessel/src/lib/raven/protocolEngine.ts Expands signal-detection regex patterns.
vessel/src/lib/raven/lexicalWeatherValidator.ts Adds validator for casual “weather” usage + rewrite helper.
vessel/src/lib/raven/fieldReportRepairFallback.ts Adjusts wording to avoid multi-choice question phrasing and uses passed driver list.
vessel/src/lib/raven/authoritySafetyValidator.ts Adds final pre-output authority safety validator.
vessel/src/lib/raven/authorityLampTemplates.ts Defines lamp enums, disclosures, capabilities, and response templates.
vessel/src/lib/raven/tests/symbolicMomentVariants.test.ts Adds coverage for deterministic variants + safety constraints.
vessel/src/lib/raven/tests/authorityLampRouter.test.ts Adds router + validator test suite coverage.
vessel/src/lib/raven/tests/affirmativeRuntimeTelemetry.test.ts Adds tests ensuring doctrinal vs infrastructure telemetry split is preserved downstream.
vessel/src/lib/plannerSignals.ts Broadens planner perturbation counter to include infrastructure events.
vessel/src/hooks/useOracleChat.ts Improves surfacing of upstream HTTP failures; adds systemNotice/isFallback on messages.
vessel/src/hooks/useElevenLabsVoice.ts Warms up convolver/reverb chain to prevent first-TTS “choke”.
vessel/src/components/reports/StructuralLoadScatter.tsx Adds vault profile selector + uses birth-input conversion for telemetry fetch.
vessel/src/components/reports/AstroPagesShell.tsx Switches shell height to min-h-dvh.
vessel/src/components/raven/AuthorityLampBadge.tsx Adds client-side authority lamp badge UI component.
vessel/src/components/chat/tests/SessionFlightRecorder.test.tsx Adds tests asserting bucket-split labeling in runtime-event descriptions.
vessel/src/components/chat/tests/DownloadSessionButton.test.ts Updates fixtures + asserts bucket-split export contract.
vessel/src/components/chat/SessionFlightRecorder.tsx Distinguishes doctrinal vs infrastructure telemetry labels/tones; exports describeRuntimeEvent().
vessel/src/components/chat/RavenThinkingFeed.tsx Treats infrastructure event as a humanizable thinking event.
vessel/src/components/chat/DownloadSessionButton.tsx Exports separate lifecycle arrays for doctrinal vs infrastructure reasons.
vessel/src/app/page.tsx Adds recovery badges + replay button; switches some shells to min-h-dvh; cleans up voice stop on unmount.
vessel/src/app/layout.tsx Adds viewport settings (including disabling zoom) + uses min-h-dvh on body.
vessel/src/app/globals.css Prefers 100dvh via @supports for app shell viewport sizing.
vessel/src/app/api/raven-chat/streamReply.ts Ensures a non-empty streamed reply by injecting a recovery fallback string.
vessel/src/app/api/raven-chat/relationalPrep.ts Minor formatting/indentation adjustment around telemetry import.
vessel/src/app/api/raven-chat/recoveryMessages.ts Adds dedicated SYSTEM/REASON/ACTION recovery message catalog.
vessel/src/app/api/raven-chat/enrichmentPhase.ts Switches “anchor unavailable” path from infrastructure event to strict doctrinal signal-void.
vessel/src/app/api/raven-chat/counterpartProvenance.ts Whitelists element tokens (Water/Earth/Fire/Air) as safe relational tokens.
vessel/src/app/api/raven-chat/tests/recoveryMessages.test.ts Adds doctrine/validator coverage tests for recovery strings.
vessel/src/app/api/raven-chat/tests/counterpartProvenance.test.ts Adds regression test for element-token authorization.
vessel/package.json Expands smoke test suite coverage; adjusts dev/start binding to 0.0.0.0:5000.
vessel/next.config.ts Adds allowedDevOrigins for Replit dev proxy origins.
scripts/post-merge.sh Adds post-merge dependency refresh + pnpm lockfile parity warning.
replit.md Adds Replit setup + git workflow notes for this repo.
package.json Adds shared deps (zod, p-limit, p-retry, etc.).
docs/stable-central-llm-guardrails.md Updates docs to mention infrastructure-event bucket in truncation signals.
docs/raven-calder/AUTHORITY_LAMP_ROUTER.md Documents the four-lamp authority routing system.
docs/PLANNER_IMPLEMENTATION_BRIEF.md Updates planner brief to distinguish doctrinal vs infrastructure events.
attached_assets/Pasted-You-have-identified-a-critical-structural-fracture-Usin_1777059570658.txt Adds attached note artifact.
attached_assets/Pasted-You-have-identified-a-critical-structural-fracture-Usin_1777059523960.txt Adds attached note artifact (duplicate content).
attached_assets/Pasted-You-are-implementing-the-Four-Lamp-Authority-Routing-Sy_1777142050333.txt Adds attached prompt artifact.
attached_assets/Pasted-Yes-that-approach-is-technically-sound-git-merge-tree-i_1777143688798.txt Adds attached workflow artifact.
attached_assets/Pasted-Yes-What-you-are-looking-at-is-the-raw-diagnostic-reado_1777059749919.txt Adds attached descriptive artifact.
attached_assets/Pasted-This-feedback-is-right-It-catches-the-remaining-leaks-i_1777055758893.txt Adds attached feedback artifact.
attached_assets/Pasted-10-24-25-127-Running-build-in-Washington-D-C-USA-East-i_1777045774555.txt Adds attached Vercel build log artifact.
attached_assets/Pasted--python-code-reference-code-event-index-2-import-pandas_1777064372013.txt Adds attached python/log artifact.
attached_assets/Pasted--MISSION-Implement-Raven-Voice-v3-Chamber-Anchoring-Law_1777044121042.txt Adds attached mission artifact.
RaveniOS/UI_REVIEW.md Adds iOS UI review notes.
RaveniOS/RaveniOS/Views/VaultView.swift Adjusts Vault styling to use Raven tokens instead of system blue.
RaveniOS/RaveniOS/Views/Today/TodayScreenView.swift Aligns Today screen palette with Raven tokens.
RaveniOS/RaveniOS/Views/Sheets/ModeSelectorView.swift Replaces system blue accents with Raven amber tokens.
RaveniOS/RaveniOS/Views/SessionSealedCard.swift Restyles sealed card to match cosmos theme + token typography.
RaveniOS/RaveniOS/Views/ChatView.swift Rethemes chat UI (background, accents, typography) to cosmos tokens.
RaveniOS/RaveniOS/RaveniOSApp.swift Adds tab bar appearance theming at app init.
RaveniOS/RaveniOS/Design/RavenDesignTokens.swift Adds typography ramp + view helpers.
.replit_integration_files/shared/models/chat.ts Adds Drizzle models and Zod insert schemas.
.replit_integration_files/server/replit_integrations/image/routes.ts Adds Replit AI image-generation route.
.replit_integration_files/server/replit_integrations/image/index.ts Exports image integration helpers.
.replit_integration_files/server/replit_integrations/image/client.ts Adds Replit AI Gemini image client helper.
.replit_integration_files/server/replit_integrations/chat/storage.ts Adds storage layer for chat integration.
.replit_integration_files/server/replit_integrations/chat/routes.ts Adds chat routes using Replit AI Integrations (Gemini).
.replit_integration_files/server/replit_integrations/chat/index.ts Exports chat integration.
.replit_integration_files/server/replit_integrations/batch/utils.ts Adds batch utilities with retry + concurrency.
.replit_integration_files/server/replit_integrations/batch/index.ts Exports batch utilities.
.replit Adds Replit workflow config + postMerge hook binding.

Comment thread vessel/src/lib/raven/symbolicMomentFrontstage.ts Outdated
Comment thread vessel/src/lib/raven/symbolicMomentFrontstage.ts Outdated
Comment thread vessel/src/lib/raven/symbolicMomentFrontstage.ts Outdated
Comment thread vessel/src/hooks/useOracleChat.ts Outdated
Comment thread vessel/src/app/layout.tsx Outdated
Comment thread vessel/src/lib/stripe.ts
Comment thread vessel/src/hooks/useElevenLabsVoice.ts
Copilot AI and others added 11 commits April 27, 2026 01:53
…s-for-symbolic-moment

# Conflicts:
#	vessel/src/lib/raven/symbolicMomentFrontstage.ts

Co-authored-by: DHCross <45954119+DHCross@users.noreply.github.com>
…lic-moment

Introduce deterministic phrasing variants for symbolic moment replies
… errors

When a Symbolic Moment read stalled mid-stream, three defects compounded:

- The Gemini reader had no per-chunk watchdog, so a stalled stream hung
  until Vercel's maxDuration killed the route, bypassing the labeled
  fallbacks in resolveReplyIntegrity.
- The client inserted an empty assistant bubble on the first DATA frame,
  leaving a ghost behind whenever no CHUNK followed.
- The outer try/catch wrapped post-stream enrichment, so a vault-sync or
  blind-mirror throw appended a generic "channel issue" bubble even when
  the reply had already streamed in.

Server: add idle (60s first-chunk / 30s subsequent) + overall (170s)
watchdogs around the Gemini reader. On stall, cancel the reader and set
providerFinishReason='stream_stall' so the existing integrity pipeline
emits GENERATION_INCOMPLETE with a Clouded Skies fallback instead of
a hung connection.

Client: defer assistant-bubble insertion until the first non-empty CHUNK,
add a 75s/45s defense-in-depth read timeout, and harden enrichment
(applyVaultAction, materializeAssistantBlindMirror, extractCheckpointQuestion)
in local try/catch blocks. Track in-flight render state in a ref so the
outer catch can suppress the redundant error bubble when the reply
already rendered. Defensively scrub any empty-text ghost on error.

Adds RAVEN_STREAM_FIRST_CHUNK_MS / RAVEN_STREAM_CHUNK_IDLE_MS /
RAVEN_STREAM_OVERALL_MS env knobs and three new integrity tests
covering the Clouded Skies stall path.

https://claude.ai/code/session_018fAnZmYcnz8i9bqS3Nsjn6
- UI_REVIEW.md: full screen survey, token-vs-view matrix, ranked fix list
- RavenDesignTokens.swift: add RavenTypography enum + View extension modifiers
  (.ravenTitle, .ravenBody, .ravenCaption, .ravenMono)
- RaveniOSApp.swift: UITabBarAppearance — cosmos dark chrome, ravenAmber selected tint
- ChatView.swift: cosmosBackground shell, amber accents, token typography,
  cosmos-tinted bubbles/input/banners, dim white text on dark field
- SessionSealedCard.swift: cosmos dark panel, amber CTA, token-driven dividers
- VaultView.swift: PRIMARY badge + active checkmark → ravenAmber
- ModeSelectorView.swift: icon/checkmark/ModePill → ravenAmber accent
- TodayScreenView.swift: cosmosBackground, ravenAmber replaces cyan throughout

No behavioral changes. ViewModels, API clients, auth flows untouched.
…hoke

Raven's first ElevenLabs response was stuttering because the reverb chain
(ConvolverNode + 1.6s impulse buffer + dry/wet gains) was lazily built on
the first sendText() call, racing the audio that was already trying to
play. Subsequent responses reused the cached graph and played cleanly.

Build the chain inside unlock() — which runs on the user's "Enable Audio"
gesture — and pass a silent 1-sample buffer through it so the convolver
allocates its kernel before any TTS audio arrives.
1. Fix effect cleanup bug: auto-play effect was not calling stop() on
   unmount, potentially leaving audio playing after component destroys.
   Now properly stops audio when dependencies change.

2. Add per-message replay button: users can click "Replay" next to "Copy"
   to re-synthesize and play the Raven response again. Button is:
   - Disabled while audio is already playing
   - Uses same normalization as auto-play (normalizeReflectionSpeechText)
   - Calls stop() before replaying to ensure clean state
   - Does not interfere with auto-play state tracking

3. Code review:
   - No master volume control (dry 0.82 + wet 0.35 reverb mix is fixed)
   - Abort/stop logic is solid and handles race conditions
   - Audio context suspension/resume works correctly
   - Message lifecycle cleanup was the only issue found
@DHCross DHCross force-pushed the claude/fix-ravens-voice-first-response-4A9Ix branch from 277e708 to 5605b1e Compare April 27, 2026 03:25
Adds two new picker buttons for multi-person reads:
- "Read All Staged" (indigo): reads all staged counterparts excluding primary
- "All In Scope" (sky): reads primary + all staged profiles together

Implements `stagedOnlyScope` option in `runSymbolicMomentLane` to pass
observer profiles only to sendMessage. Updates picker copy based on the
number of staged profiles and adds tooltips explaining each option.

https://claude.ai/code/session_01WiNwPjtGzyNaAMab6srzqy
Adds two new picker buttons for multi-person reads:
- "Read All Staged" (indigo): reads all staged counterparts excluding primary
- "All In Scope" (sky): reads primary + all staged profiles together

Implements `stagedOnlyScope` option in `runSymbolicMomentLane` to pass
observer profiles only to sendMessage. Updates picker copy based on the
number of staged profiles and adds tooltips explaining each option.

https://claude.ai/code/session_01WiNwPjtGzyNaAMab6srzqy
@DHCross
Copy link
Copy Markdown
Owner Author

DHCross commented Apr 27, 2026

@copilot apply changes based on the comments in this thread

…, and merge conflict repair

Agent-Logs-Url: https://github.com/DHCross/Shipyard/sessions/77a7185d-bb36-4161-b943-6907468b7bd6

Co-authored-by: DHCross <45954119+DHCross@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

@copilot apply changes based on the comments in this thread

Applied all changes from the review thread in commit 43c1668:

useOracleChat.ts

  • parsedError now prefers errData.message (human-readable) over errData.error (machine code), falling back to extractApiErrorMessage
  • Removed stale >>>>>>> e1de1379 merge conflict marker that was causing a typecheck cascade failure — also repaired the structural damage it masked: missing closing brace on else if, unclosed if (onDebugInfo) block, duplicate inflightAssistantRef declaration, duplicate unreachable return block referencing out-of-scope variables, and undeclared didGatewayRetry/gatewayRetryStatus variables

useElevenLabsVoice.ts

  • Added onended disconnect callback to the reverb warm-up AudioBufferSourceNode so it cleanly disconnects after firing, preventing node accumulation on repeated unlock() calls

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants